home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 4.4 KB | 139 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UMovieViewer.cp
- // Copyright © 1996 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UMovieViewer__
- #include "UMovieViewer.h"
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // Constants:
-
- const OSType kSignature = 'MS01'; // Application signature
- const OSType kFileType = 'MooV'; // open Movie files only
-
- const cPlayEveryFrame = 1001;
-
- //========================================================================================
- // CLASS TMovieViewerApplication
- //========================================================================================
-
-
- #undef Inherited
- #define Inherited TApplication
-
- #pragma segment AInit
- MA_DEFINE_CLASS_M1(TMovieViewerApplication, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TMovieViewerApplication::IMovieViewerApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment AInit
-
- void TMovieViewerApplication::IMovieViewerApplication()
- {
- this->IApplication(kFileType, kSignature);
-
- fLaunchWithNewDocument = FALSE;
-
- // So the linker doesn't dead strip class info
-
- MA_REGISTER_CLASS(TMovieView);
- MA_REGISTER_CLASS(TMovieController);
-
- // So my view will be substituted when MacApp® creates the "default view"
-
- MA_REGISTER_SIGNATURE(TMovieView, 'dflt');
-
- } // TMovieViewerApplication::IMovieViewerApplication
-
- //----------------------------------------------------------------------------------------
- // TMovieViewerApplication::DoMakeDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TDocument* TMovieViewerApplication::DoMakeDocument( CommandNumber /*itsCommandNumber*/,
- TFile* itsFile) // Override
- {
- TMovieViewerDocument* aDocument = new TMovieViewerDocument;
-
- aDocument->IMovieViewerDocument(itsFile, kSignature);
- return aDocument;
-
- } // TMovieViewerApplication::DoMakeDocument
-
- //========================================================================================
- // CLASS TMovieViewerDocument
- //========================================================================================
-
-
- #undef Inherited
- #define Inherited TFileBasedDocument
-
- #pragma segment AInit
- MA_DEFINE_CLASS_M1(TMovieViewerDocument, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TMovieViewerDocument::IMovieViewerDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TMovieViewerDocument::IMovieViewerDocument(TFile* itsFile, OSType itsCreator)
- {
- this->IFileBasedDocument(itsFile, itsCreator);
-
- //
- // create a TMovie using the document file
- //
- if(itsFile)
- {
- TMovie *movie = new TMovie;
- movie->IMovie(itsFile);
- fMovie = movie;
- }
- else
- fMovie = NULL;
-
- } // TMovieViewerDocument::IMovieViewerDocument
-
- //----------------------------------------------------------------------------------------
- // TMovieViewerDocument::Free:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TMovieViewerDocument::~TMovieViewerDocument()
- {
- fMovie = (TMovie*)FreeIfObject(fMovie);
- } // TMovieViewerDocument::~TMovieViewerDocument
-
- //----------------------------------------------------------------------------------------
- // TMovieViewerDocument::DoMakeViews:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TMovieViewerDocument::DoMakeViews(Boolean /*forPrinting*/) // Override
- {
- /*
- ** get the default MacApp window
- ** get the movie's frame
- ** and set its size to that of the movie plus room for the scrollers
- */
- TView* aView = gViewServer->NewTemplateWindow(kDefaultWindowID, this);
-
- /*
- ** get the default MacApp view in the window
- ** and let it know about the movie
- */
- TMovieView* movieView =(TMovieView*)aView->FindSubView(kIDDefaultView);
- if(fMovie)
- movieView->HaveMovie(fMovie);
-
- } // TMovieViewerDocument::DoMakeViews
-
- //----------------------------------------------------------------------------------------
- // End of UMovieViewer.cp
-
- #pragma segment Inline
-